<template>
  <!--会签管理-审批设置列表-付款申请设置弹窗-->
    <j-modal
      :title="title"
      :width="width"
      :visible="visible"
      switchFullscreen
      @ok="handleOk"
      :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
      :cancelButtonProps="{ class:{'jee-hidden': disableSubmit1} }"
      @cancel="handleCancel"
      okText="提交">
      <!-- 操作按钮区域 -->
      <div v-if="pageType === 'edit'" class="table-operator" style="display: flex;align-items: center;margin-bottom: 10px;">
        <a-button @click="handleAddZur('add','新增审批人')" style="background-color:#32cd99;color: white;">新增审批人</a-button>
        <div style="color: red;">审批序号不能断序，断序将导致该流程无法开启。</div>
      </div>
      <wt-shezhi-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" @handleDelete="handleDelete" @handleAddZur="handleAddZur" :pageType="pageType"></wt-shezhi-form>
    </j-modal>
  </template>

  <script>

    import WtShezhiForm from './WtShezhiForm'
    export default {
      name: 'WtShenpiModal',
      components: {
        WtShezhiForm
      },
      props: {
        pageType:{
          type: String,
          default: '',
        }
      },
      data () {
        return {
          title:'',
          width:1000,
          visible: false,
          disableSubmit: true,
          disableSubmit1:true,
        }
      },
      methods: {
        add () {
          this.visible=true
          this.$nextTick(()=>{
            this.$refs.realForm.add();
          })
        },
        edit (record) {
          console.log(1,record)
          this.visible = true;
          this.$nextTick(()=>{
            this.$refs.realForm.edit(record);
          })
        },
        close () {
          this.$emit('close');
          this.visible = false;
        },
        handleOk () {
          this.$refs.realForm.submitForm();
        },
        handleAddZur(type,record){
          this.$emit('handleAddZur',type,record);
        },
        submitCallback(){
          this.$emit('ok');
          this.visible = false;
        },
        handleDelete(record){
           console.log(22,record)
          this.$emit('handleDelete',record)
        },
        handleCancel () {
          this.close()
        }
      }
    }
  </script>